package bean;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.example.administrator.thread_test.R;

import java.util.ArrayList;

public class infoAdapter extends ArrayAdapter<book_info> {
    private int resourceId;

    public infoAdapter(Context context, int textViewResourceID, ArrayList<book_info> object)
    {
        super(context,textViewResourceID,object);
        resourceId = textViewResourceID;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {
        book_info book_info = getItem(position);
        View view = LayoutInflater.from(getContext()).inflate(resourceId,parent,false);
        TextView info_index = (TextView)view.findViewById(R.id.info_index);
        info_index.setText(book_info.getInfo_index());
        TextView info_num = (TextView)view.findViewById(R.id.info_num);
        info_num.setText(book_info.getInfo_num());
        TextView info_address = (TextView)view.findViewById(R.id.info_address);
        info_address.setText(book_info.getInfo_address());
        TextView info_status = (TextView)view.findViewById(R.id.info_status);
        info_status.setText(book_info.getInfo_status());
        return view;
    }
}
